package com.googlecode.imanager.core.base;

import com.googlecode.imanager.client.bridge.IComponent;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public abstract class BridgeComponent implements IComponent {

    private BridgeState state;
    
    public BridgeComponent() {
        this.state = BridgeState.INITIALIZING;
    }
    
    public boolean isInitializing() {
        return state == BridgeState.INITIALIZING;
    }

    public boolean isRunning() {
        return state == BridgeState.RUNNING;
    }

    public boolean isDropped() {
        return state == BridgeState.DROPPED;
    }
    
    public BridgeState getState() {
        return state;
    }

    protected void start() {
        state = BridgeState.RUNNING;
    }

    protected void destroy(){
        state = BridgeState.DROPPED;
    }

}
